import http from '@/axios/http.js';
import baseUrl from '@/constant/orderDetail/apiUrl.js';
// import mock from '@/mock/api/modelEvaluating/data.js';

const env = import.meta.env.VITE_MODE_NAME;

export default {
	//收货人列表信息
	getaddressList(uId) {
		if (env == 'development') {
			return http.get(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.userAddress + uId);
		} else if (env == 'test') {
			return http.get(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.userAddress + uId);
		}
	},
	//添加收货人信息
	insertAddressInfo(uId,UserAddressDto){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.insertUserAddress + uId,UserAddressDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.insertUserAddress + uId,UserAddressDto);
		}
	},
	//修改收货人信息
	updateAddressInfo(addressId,UserAddressDto){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.updateUserAddress + addressId,UserAddressDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.updateUserAddress + addressId,UserAddressDto);
		}
	},
	//设置默认地址
	setDefaultAddress(addressId){
		if (env == 'development') {
			return http.put(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.defaultAddress + addressId);
		} else if (env == 'test') {
			return http.put(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.defaultAddress + addressId);
		}
	},
	//删除非默认地址
	deleteAddress(addressId){
		if (env == 'development') {
			return http.delete(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.deleteAddress + addressId);
		} else if (env == 'test') {
			return http.delete(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.deleteAddress + addressId);
		}
	},
	//商品列表
	getOrderGoodsList(uId,orderId){
		if (env == 'development') {
			return http.get(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.goodsList + uId+ '/' + orderId);
		} else if (env == 'test') {
			return http.get(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.goodsList + uId+ '/' + orderId);
		}
	},
	payOrder(uId,orderDto){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.payOrder + uId,orderDto);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.payOrder + uId,orderDto);
		}
	},
	//用户未正常进行订单流程，添加未支付订单
	createWaitOrder(uId,orderId){
		if (env == 'development') {
			return http.post(import.meta.env.VITE_API_URL_GATEWAY + baseUrl.createWaitOrder + uId + '/' + orderId);
		} else if (env == 'test') {
			return http.post(import.meta.env.VITE_API_URL_PAYMENT + baseUrl.createWaitOrder + uId + '/' + orderId);
		}
	}
}
